package com.framework.modules.base.service.impl;

import com.framework.common.utils.DateUtils;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.common.utils.PageUtils;
import com.framework.common.utils.Query;

import com.framework.modules.base.dao.UserReportDao;
import com.framework.modules.base.entity.UserReportEntity;
import com.framework.modules.base.service.UserReportService;


@Service("userReportService")
public class UserReportServiceImpl extends ServiceImpl<UserReportDao, UserReportEntity> implements UserReportService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<UserReportEntity> page = this.selectPage(
                new Query<UserReportEntity>(params).getPage(),
                new EntityWrapper<UserReportEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public Object addReport(UserReportEntity entity) {
        entity.setAdddate(DateUtils.getSecondTimestamp(new Date()));
        return this.baseMapper.insert(entity);
    }

}
